import { getDailyBoxOfficeStats } from '@/api/movie'
import { fetchTodayRevenue } from '@/api/order'
const state = {
  dailyBoxOfficeData: [],
  todayBoxOffice: {}
}
const getters = {
}
const mutations = {
  GETDAILYBOXOFFICESTATS (state, dailyBoxOfficeStats) {
    state.dailyBoxOfficeData = dailyBoxOfficeStats
  },
  GETTODAYBOXOFFICE (state, todayBoxOffice) {
    state.todayBoxOffice = todayBoxOffice
  }
}
const actions = {
  async getDailyBoxOfficeStats ({ commit }) {
    const result = await getDailyBoxOfficeStats()
    commit('GETDAILYBOXOFFICESTATS', result.data)
  },
  async getTodayBoxOffice ({ commit }) {
    const result = await fetchTodayRevenue()
    console.log(result)
    commit('GETTODAYBOXOFFICE', result.data)
  }

}
export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}
